#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int decide(char idcard[])
{
    int z = 0;
    int a = 0;
    int all = 0;
    char weight[18] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };
    for (a = 0; a < 17; a++)
    {
        all = all + (weight[a] - '0') * (idcard[a] - '0');
    }
    all = all % 11;
    if ((0 == all) && (idcard[17] == '1'))
        z = 1;
    else if ((1 == all) && (idcard[17] == '0'))
        z = 1;
    else if ((2 == all) && (idcard[17] == 'x'))
        z = 1;
    else if (all + (idcard[17] - '0') == 12)
        z = 1;
    return z;
}

int main()
{
    int an = 0;
    int p = 0;
    int n = 0;
    scanf("%d", &n);
    char idcard[19];
    int w = 0;
    for (w = 1; w <= n; w++)
    {
        scanf("%s", idcard);
        int z = 0;
        int a = 0;
        int all = 0;
        int weight[18] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };
        for (a = 0; a < 17; a++)
        {
            all = all + weight[a] * (idcard[a] - '0');
        }
        all = all % 11;
        if ((0 == all) && (idcard[17] == '1'))
            z = 1;
        else if ((1 == all) && (idcard[17] == '0'))
            z = 1;
        else if ((2 == all) && (idcard[17] == 'x'))
            z = 1;
        else if (all + (idcard[17] - '0') == 12)
            z = 1;
        an = z;
        if (an == 0)
        {
            printf("%s\n", idcard);
        }
    }
    if (1 == an)
        printf("all passed\n");
    return 0;
}
